// 发药查询
import React from 'react';
import { Select, DatePicker, Button, Row, Col, Input, Card, Tabs, Table, Icon, message } from 'antd';
import { $http } from 'containers/config/https';
import Moment from 'moment';
import store from 'store';
import './style/index.less';

import PubilcTablePagination from 'pages/common/PubilcTablePagination';
import PublicModalTable from 'pages/common/PublicModalTable';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import CommonPagination from 'components/pagination/index';
import { printSummary } from './commonPrint/stkPrint'
import { printDetailed } from './commonPrint/stkPrint'
import { printOralLabelDetailed } from './commonPrint/stkPrint'
const { TabPane } = Tabs;
const { Option } = Select;
let timeout = null;

export default class HPDrugInquiry extends React.Component {
  constructor() {
    super();
    this.state = {
      pharmacy: undefined,
      selectData: {},
      wardSelectData: [],
      startDate: undefined,
      endDate: undefined,
      wardID: undefined,
      drugName: undefined,
      modalTableData: [],
      top: 0,
      left: 0,
      drugData: {},
      activeTabPaneKey: '1',
      dispUser: undefined,
      dispCat: undefined,
      patID: undefined,
      pageSize: 20,
      page: 1,
      total: 0,
      tableData: [],
      parameterCode: '',
      columns: [],
      totalWidth: 0,
      // 汇总
      summaryColumns: [],
      summaryData: [],
      summaryPage: 1,
      summaryPageSize: 10,
      summaryTotal: 0,
      loading: false,
      summaryTotalWidth: 0,
      // 明细
      detailColumns: [],
      detailData: [],
      detailTotalWidth: 0,
      detailPage: 1,
      detailPageSize: 10,
      detailTotal: 0,

      rowID: undefined,
      dispCatDesc: '',
      subclassData: {}, //发药类别数据
      subclassTotal: undefined,
      selectedRowKeys: [],
      selectedRows: [],
    };
    this.modalColumns = [
      {
        key: 1,
        title: '库存项代码',
        dataIndex: 'stockCode',
        align: 'center',
        width: '22%'
      },
      {
        key: 2,
        title: '库存项描述',
        dataIndex: 'stockDesc',
        align: 'center',
        width: '24%',
      },
      {
        key: 5,
        title: '库存分类',
        dataIndex: 'stkSubCatDesc',
        align: 'center',
        width: '16%',
      },
      {
        key: 3,
        title: '包装规格',
        dataIndex: 'stockSpec',
        align: 'center',
        width: '12%',
      },
      {
        key: 6,
        title: '基本单位',
        dataIndex: 'baseUnitDesc',
        align: 'center',
        width: '12%',
      },
      {
        key: 7,
        title: '入库单位',
        dataIndex: 'purUnitDesc',
        align: 'center',
      }
    ]
  }

  componentDidMount() {
    this.getParameterSetting();
    this.getColumnsData();
    this.getSummaryColumns();
    this.child.handleLoading();
  }

  // 获取初始化以及下拉框数据
  getParameterSetting = () => {
    let data = {
      params: []
    }
    $http.post('urlS', this, {
      code: '02040056',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          this.setState({
            startDate: res.result && res.result.startDate ? Moment(res.result.startDate) : Moment(),
            endDate: res.result && res.result.endDate ? Moment(res.result.endDate) : undefined,
            selectData: res.result,
            pharmacy: res.result.loc && res.result.loc.length > 0 ? res.result.loc[0].id : undefined
          }, () => {
            this.getLeftTableData()
          })
        }
      }
    })
  }

  // 获取左侧表格数据
  handleQuery = () => {
    this.setState({ page: 1 }, () => {
      this.getLeftTableData()
    })
  }

  // 获取表头数据
  getColumnsData = () => {
    let data = {
      params: [{
        compontName: 'drugInquiry',
        type: 'C',
      }]
    }
    $http.post('urlS', this, {
      code: '01040073',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
            return {
              ...item,
              key: index + 1,
              title: <div onDoubleClick={() => {
                this.setState({ parameterCode: 'drugInquiry' }, () => {
                  this.columnRef.onOpenModel();
                })
              }}>{item.title}</div>
            }
          }) : '';
          let filterArr = arr.filter(function (item) { return item.display === 'Y' });
          this.setState({ columns: filterArr, totalWidth: res.totalWidth })
        }
      }
    })
  }


  // 获取左侧表格数据
  getLeftTableData = () => {
    this.setState({ loading: true })
    let { startDate, endDate, pharmacy, wardID, pageSize, page, drugData, dispUser, dispCat, patID } = this.state;
    let data = {
      params: [{
        locID: pharmacy,
        wardID,
        startDate: startDate ? Moment(startDate).format('YYYY-MM-DD') : '', // 开始日期
        endDate: endDate ? Moment(endDate).format('YYYY-MM-DD') : '', // 截止日期
        stockID: drugData && drugData.stockID ? drugData.stockID : '',
        dispCatID: dispCat,
        dispUserID: dispUser,
        patID
      }],
      pagination: [{
        pageSize,
        currentPage: page,
      }]
    }
    $http.post('urlS', this, {
      code: '02040057',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          for (var i = 0; i < res.result.rows.length; i++) {
            res.result.rows[i].key = res.result.rows[i].dispID;
            res.result.rows[i].dispDateTime = res.result.rows[i].dispDate + ' ' + res.result.rows[i].dispTime
          }
          this.setState({
            tableData: res.result.rows,
            total: res.result.total,
            loading: false,
          }, () => {
            this.handleClearData();
          })
        }
      }
    })
  }

  // 提供修改page和pageSize的回调函数
  compilePage(page, pageSize) {
    // 修改page，或者pageSize
    this.setState({ page, pageSize }, () => {
      // 重新调用查询方法
      this.getLeftTableData()
    })
  }

  // 药房查询条件
  handlePharmacyOnChange = e => {
    this.setState({ pharmacy: e })
  }

  // 开始日期
  handleStartDate = e => {
    this.setState({ startDate: e })
  }

  // 结束日期
  handleEndDate = e => {
    this.setState({ endDate: e })
  }

  // 请求病区下拉框数据(病区)
  handleWardSelectData = (value) => {
    if (timeout) {
      clearTimeout(timeout);
      timeout = null;
    }
    timeout = setTimeout(() => {
      if (value) {
        let data = {
          params: [{
            alias: value
          }]
        }
        $http.post('urlS', this, {
          code: '02040003',
          data: data,
          success: function (res) {
            if (+res.errorCode === 0) {
              this.setState({ wardSelectData: res.result })
            }
          }
        })
      }
    }, 300)
  }

  // 病区
  handleWardOnChange = e => {
    this.setState({ wardID: e }, () => {
      this.getLeftTableData();
    })
  }

  // 药品名称
  handleDrugNameChange = (e) => {
    if (!e.target.value) {
      this.setState({ drugData: {} }, () => {
        this.getLeftTableData();
      })
    }
    this.setState({ drugName: e.target.value });
  };

  // 描述回车事件
  stockDescOnPressEnter = (e) => {
    let top = document.getElementById('stock-desc').getBoundingClientRect().top + 40 + 'px';
    let left = document.getElementById('stock-desc').getBoundingClientRect().left + 'px'; // 如果弹窗宽度修改了则要基于600做减法(比如变成了800则需要减去200)
    this.setState({
      top,
      left
    });
    this.getModalListData(e.target.value);
    this.drugChild.showModal();
  };

  // 获取描述列表数据
  getModalListData = (alias) => {
    let data = {
      params: [
        {
          stockAlias: alias, // 库存项描述别名
          frLocID: undefined
        }
      ]
    };
    $http.post('urlS', this, {
      code: '02020042',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          for (var i = 0; i < res.result.length; i++) {
            res.result[i].key = i
          }
          this.setState({ modalTableData: res.result })
        } else {
          this.setState({ modalTableData: [] })
        }
      }
    })
  }

  // 操作弹框
  handleDrugRowClick = (record) => {
    return {
      onDoubleClick: () => {
        this.confirmSelection(record);
      }
    }
  };

  // 双击选中行数据的回调
  confirmSelection = (record) => {
    // this.resetFields();
    this.setState({ drugName: record.stockDesc, drugData: record }, () => {
      // 关闭弹窗
      this.drugChild.handleCancel();
    })
  };

  onDrugRef = ref => {
    this.drugChild = ref;
  }

  // 切换医嘱查询页签
  toggleTabPane = key => {
    this.setState({ activeTabPaneKey: key }, () => {
      if (this.state.activeTabPaneKey === '1') {
        this.handleSummaryQuery();
      } else if (this.state.activeTabPaneKey === '2') {
        if (!(this.state.detailColumns && this.state.detailColumns.length > 0)) {
          this.getDetailColumns();
        }
        this.handleDeleteQuery();
      }
    })
  }

  onRef = ref => {
    this.child = ref
  }

  // 病人ID
  handlePatChange = (e) => {
    this.setState({ patID: e.target.value })
  }

  // 发药人
  handleDispUserIDOnChange = e => {
    this.setState({ dispUser: e })
  }

  // 发药类别
  handleDispCatOnChange = e => {
    this.setState({ dispCat: e })
  }

  //组件权限编辑器
  onColumnRef = (ref) => {
    this.columnRef = ref;
  };

  // 病区、病人行操作
  onClickRowPublic = (record) => {
    return {
      // 单击行选中
      // onClick: () => {
      //   if (this.state.rowID === '') {
      //     // 保存行数据以及ID
      //     this.setState({ rowID: record.dispID, rowData: record, dispCatDesc: record.dispCatDesc }, () => {
      //       this.getDetailData();
      //     });
      //   } else {
      //     if (this.state.rowID !== record.key) {
      //       this.setState({ rowID: record.dispID, rowData: record, dispCatDesc: record.dispCatDesc }, () => {
      //         this.getDetailData();
      //       });
      //     }
      //   }
      // }
      onClick: () => {
        let { selectedRowKeys = [], selectedRows = [], rowID, dispCatDesc, rowData } = this.state;
        const index = selectedRowKeys.indexOf(record.dispID);
        const isSelected = index !== -1;

        if (isSelected) {
          // 再次点击移除选中
          selectedRowKeys.splice(index, 1);
          selectedRows.splice(index, 1);
          rowID = '';
          dispCatDesc = '';
          rowData = {};
          if (record.dispID !== rowID) {
            rowID = record.dispID;
            rowData = record;
            dispCatDesc = record.dispCatDesc
          }
        } else {
          // 将点击的行添加到选中
          selectedRowKeys.push(record.dispID);
          selectedRows.push(record);
          rowID = record.dispID;
          rowData = record;
          dispCatDesc = record.dispCatDesc
        }
        this.setState({
          rowID,
          rowData,
          dispCatDesc,
          selectedRowKeys,
          selectedRows
        }, () => {
          this.getDetailData()
        });
      },
    }
  }

  // 查询明细数据
  getDetailData = () => {
    const { rowID, selectedRowKeys } = this.state;
    if (!rowID && selectedRowKeys && selectedRowKeys.length === 0) {
      this.handleClearData();
      return;
    }
    if (this.state.activeTabPaneKey === '1') {
      this.handleSummaryQuery();
    } else if (this.state.activeTabPaneKey === '2') {
      this.handleDeleteQuery();
    }
    this.getStkRepSubCatList();
  }

  handleClearData = () => {
    this.setState({
      rowID: '',
      rowData: {},
      subclassData: {},
      selectedRowKeys: [],
      selectedRows: [],
      summaryData: [],
      detailData: [],
      summaryTotal: 0,
      detailTotal: 0
    })
  }

  setRowClassNamePublic = (record) => {
    return record.dispID === this.state.rowID ? 'clickRowStyle' : '';
  }


  // 获取发药类别列表数据
  getStkRepSubCatList = () => {
    const { selectedRows } = this.state;
    let userData = JSON.parse(sessionStorage.getItem('userData'));
    let dispCatDescArr = [];
    for (let i = 0; i < selectedRows.length; i++) {
      dispCatDescArr.push(selectedRows[i]?.dispCatDesc || '');
    }
    let data = {
      params: [{
        locID: userData ? userData.locID : '',
        dispCatDesc: this.state.dispCatDesc,
        dispCatDescArr
      }]
    };
    $http.post('urlS', this, {
      code: '02040064',
      data: data,
      success: function (res) {
        if (res.errorCode == 0) {
          this.setState({ subclassData: res.rows, subclassTotal: res.total });
        } else {
          this.setState({ subclassData: {} });
        }
      },
      error: function (err) {
        message.error(err.errorMessage)
      }
    });
  };
  // 获取汇总表头数据
  getSummaryColumns = () => {
    let data = {
      params: [{
        compontName: 'DrugDeliverySummaryInformation',
        type: 'C',
      }]
    }
    $http.post('urlS', this, {
      code: '01040073',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
            return {
              ...item,
              key: index + 1,
              title: <div onDoubleClick={() => {
                this.setState({ parameterCode: 'DrugDeliverySummaryInformation' }, () => {
                  this.columnRef.onOpenModel();
                })
              }}>{item.title}</div>
            }
          }) : '';
          let filterArr = arr.filter(function (item) { return item.display === 'Y' });
          this.setState({ summaryColumns: filterArr, summaryTotalWidth: res.totalWidth })
        }
      }
    })
  }

  // 查询汇总信息
  handleSummaryQuery = () => {
    this.setState({ summaryPage: 1 }, () => {
      this.getSummaryInformation()
    })
  }

  // 获取汇总信息
  getSummaryInformation = () => {
    let { summaryPage, summaryPageSize, rowData, drugData, patID, selectedRowKeys } = this.state;
    this.setState({ loading: true })
    let data = {
      params: [{
        dispID: rowData.dispID,
        dispIDArr: selectedRowKeys,
        stockID: drugData && drugData.stockID ? drugData.stockID : '',
        patID
      }],
      pagination: [{
        pageSize: summaryPageSize,
        currentPage: summaryPage,
      }]
    }
    $http.post('urlS', this, {
      code: '02040058',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          for (var i = 0; i < res.result.rows.length; i++) {
            res.result.rows[i].key = i;
          }
          this.setState({ summaryData: res.result.rows, summaryTotal: res.result.total, loading: false })
        }
      }
    })
  }

  handleSummaryCompilePage = (page, pageSize) => {
    this.setState({ summaryPageSize: pageSize, summaryPage: page }, () => {
      this.getSummaryInformation()
    })
  }

  handleDeleteQuery = () => {
    this.setState({ detailPage: 1 }, () => {
      this.getDetailInformation()
    })
  }

  // 获取明细表头数据 
  getDetailColumns = () => {
    let data = {
      params: [{
        compontName: 'DrugDeliveryDetails',
        type: 'C',
      }]
    }
    $http.post('urlS', this, {
      code: '01040073',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
            return {
              ...item,
              key: index + 1,
              title: <div onDoubleClick={() => {
                this.setState({ parameterCode: 'DrugDeliveryDetails' }, () => {
                  this.columnRef.onOpenModel();
                })
              }}>{item.title}</div>
            }
          }) : '';
          let filterArr = arr.filter(function (item) { return item.display === 'Y' });
          this.setState({ detailColumns: filterArr, detailTotalWidth: res.totalWidth })
        }
      }
    })
  }

  // 获取发药明细信息
  getDetailInformation = () => {
    let { detailPage, detailPageSize, rowData, drugData, patID, selectedRowKeys } = this.state;
    this.setState({ loading: true })
    let data = {
      params: [{
        dispID: rowData.dispID,
        dispIDArr: selectedRowKeys,
        stockID: drugData && drugData.stockID ? drugData.stockID : '',
        patID
      }],
      pagination: [{
        pageSize: detailPageSize,
        currentPage: detailPage,
      }]
    }
    $http.post('urlS', this, {
      code: '02040059',
      data: data,
      success: function (res) {
        if (+res.errorCode === 0) {
          for (var i = 0; i < res.result.rows.length; i++) {
            res.result.rows[i].key = i;
          }
          this.setState({ detailData: res.result.rows, detailTotal: res.result.total, loading: false })
        }
      }
    })
  }

  handleDetailCompilePage = (page, pageSize) => {
    this.setState({ detailPageSize: pageSize, detailPage: page }, () => {
      this.getDetailInformation();
    })
  }

  render() {
    let { pharmacy, selectData, startDate, endDate, wardID, drugName, modalTableData, top, left, activeTabPaneKey, tableData, dispUser, dispCat, patID, page, total, columns, totalWidth, summaryColumns, summaryData,
      summaryPage, summaryTotal, loading, summaryTotalWidth, detailColumns, detailData, detailTotalWidth, detailPage, detailTotal, selectedRowKeys, selectedRows
    } = this.state;

    let param = {
      // 表头配置
      columns,
      // 表格数据
      data: tableData,
      page,
      total,
      pageSize: 20,
      // 表格的宽度
      x: totalWidth,
      y: store.getState().tableHeight.y + 10,
      height: store.getState().tableHeight.y + 55 + 'px',
      isOnRow: true,
      rowClassName: true,
      loading,
      TableClassName: 'inquiry-of-rejected-drugs',
    }

    let drugParam = {
      width: '600px',
      top,
      left,
      columns: this.modalColumns,
      data: modalTableData,
      isOnRow: true,
      TableClassName: 'tab-placeholder',
    };

    let rowSelection = {
      selectedRowKeys,
      selectedRows,
      onChange: (selectedRowKeys, selectedRows) => {
        this.setState({
          selectedRowKeys,
          selectedRows,
        }, () => {
          this.getDetailData();
        })
      },
    };

    // 药房
    let pharmacyOption = selectData.loc && selectData.loc.map((item, index) => {
      return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
    })
    // 病区
    let wardAreaOption = selectData.ward && selectData.ward.map((item, index) => {
      return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
    })
    // 发药人
    let dispUserOption = selectData.dispUser && selectData.dispUser.map((item, index) => {
      return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
    })
    // 发药类别
    let dispCatOption = selectData.dispCat && selectData.dispCat.map((item, index) => {
      return (<Option key={index} value={item.dispCatID} title={item.dispCatDesc} seatchprop={item.dispCatDesc}>{item.dispCatDesc}</Option>)
    })
    return (
      <div className="drug-inquiry">
        <Row style={{ padding: '0 24px' }}>
          <Col span={24}>
            <div style={{ marginBottom: '8px' }}>
              药房：<Select allowClear value={pharmacy} onChange={this.handlePharmacyOnChange} showSearch optionFilterProp="seatchprop" placeholder="请选择" style={{ width: '150px', margin: '8px 8px 0 0' }}>
                {pharmacyOption}
              </Select>
              <DatePicker
                value={startDate}
                onChange={this.handleStartDate}
                style={{ width: '150px', marginTop: '8px' }}
                placeholder="开始日期"
                allowClear={false}
              />
              <span style={{ display: 'inline-block', margin: '0 5px' }}>到</span>
              <DatePicker
                value={endDate}
                onChange={this.handleEndDate}
                style={{ width: '150px', marginRight: '8px' }}
                placeholder="结束日期"
                allowClear={false}
              />
              药品名称：<Input id="stock-desc" style={{ width: "200px", margin: '8px 8px 0 0' }} placeholder='回车检索药品相关信息' allowClear onPressEnter={this.stockDescOnPressEnter} value={drugName} onChange={this.handleDrugNameChange} />
              发药人: <Select allowClear value={dispUser} onChange={this.handleDispUserIDOnChange} showSearch optionFilterProp="seatchprop" placeholder="请选择" style={{ width: '150px', margin: '8px 8px 0 0' }}>
                {dispUserOption}
              </Select>
              发药类别：<Select allowClear value={dispCat} onChange={this.handleDispCatOnChange} showSearch optionFilterProp="seatchprop" placeholder="请选择" style={{ width: '150px', margin: '8px 8px 0 0' }}>
                {dispCatOption}
              </Select>
              病人ID：<Input allowClear value={patID} onChange={this.handlePatChange} style={{ width: '150px', marginRight: '8px' }} onPressEnter={this.getLeftTableData} placeholder="请输入" />
              病区：<Select allowClear value={wardID} onChange={this.handleWardOnChange} showSearch optionFilterProp="seatchprop" placeholder="请选择" style={{ width: '150px', margin: '8px 8px 0 0' }}>
                {wardAreaOption}
              </Select>
              <Button style={{ marginTop: '8px' }} onClick={this.getLeftTableData}>查询</Button>
            </div>
          </Col>
          {/* <Col span={2} style={{textAlign: 'right'}}>
            <Button style={{marginTop: '8px'}} onClick={this.getLeftTableData}>查询</Button>
          </Col> */}
        </Row>
        <div style={{ height: '6px', background: 'rgba(240, 242, 245, 1)', width: '100%' }}></div>
        <Row>
          <Col span={8}>
            <Card
              size="small"
              className="hp-card-left"
              title={<div className="card-title-left-icon"><div></div>发药列表</div>}
            >
              <div style={{ height: store.getState().tableHeight.y + 113 + 'px', overflow: 'auto' }}>
                <PubilcTablePagination
                  param={param}
                  handelThis={this}
                  onRef={this.onRef}
                  rowSelectionPublic={rowSelection}
                  onClickRowPublic={this.onClickRowPublic}
                  setRowClassNamePublic={this.setRowClassNamePublic}
                />
              </div>
            </Card>
          </Col>
          <Col span={16}>
            <div style={{ paddingLeft: '6px', position: 'relative' }}>
              <Card
                size="small"
                title={
                  <div className="card-title-left-icon">
                    <div></div>
                    发药明细
                  </div>
                }
                extra={(
                  <div className="flex-align-items">
                    <span><Button type="dashed"
                      style={{ marginRight: '8px', color: !this.state.rowID ? '#d9d9d9' : '#1890FF', borderColor: !this.state.rowID ? '#d9d9d9' : '#1890FF' }}
                      onClick={printSummary.bind(this, this.state.rowID, selectedRowKeys)}
                      disabled={this.state.subclassData["1"] === '1' ? false : true}
                    >打印汇总</Button></span>
                    <span><Button type="dashed"
                      style={{ marginRight: '8px', color: !this.state.rowID ? '#d9d9d9' : '#1890FF', borderColor: !this.state.rowID ? '#d9d9d9' : '#1890FF' }}
                      onClick={printDetailed.bind(this, this.state.rowID, selectedRowKeys)}
                      disabled={this.state.subclassData["2"] === '1' ? false : true}   ////!this.state.rowID&&!()
                    >打印明细</Button></span>
                    <span><Button type="dashed"
                      style={{ color: !this.state.rowID ? '#d9d9d9' : '#1890FF', borderColor: !this.state.rowID ? '#d9d9d9' : '#1890FF' }}
                      onClick={printOralLabelDetailed.bind(this, this.state.rowID, selectedRowKeys)}
                      disabled={this.state.subclassData["3"] === '1' ? false : true}
                    >打印标签</Button></span>
                  </div>
                )}
              >
                <Tabs activeKey={activeTabPaneKey} onChange={this.toggleTabPane}>
                  <TabPane tab="发药汇总信息" key="1">
                    <div style={{ height: store.getState().tableHeight.y + 54 + 'px', overflow: 'auto' }}>
                      <Table
                        // rowSelection={rowSelection}
                        columns={summaryColumns}
                        dataSource={summaryData}
                        bordered
                        pagination={false}
                        scroll={{ x: summaryTotalWidth, y: store.getState().tableHeight.y - 50 }}
                        className="inquiry-of-rejected-drugs"
                      // onRow={this.handleOnRow}
                      // rowClassName={this.handleRowClassName}
                      />
                      <CommonPagination size='small' current={summaryPage} total={summaryTotal} search='search'
                        onShowSizeChange={this.handleSummaryCompilePage} complete={true} dataSource={summaryData}
                        loading={loading} onChange={this.handleSummaryCompilePage} />
                    </div>
                  </TabPane>
                  <TabPane tab="发药明细信息" key="2">
                    <div style={{ height: store.getState().tableHeight.y + 54 + 'px', overflow: 'auto' }}>
                      <Table
                        // rowSelection={rowSelection}
                        columns={detailColumns}
                        dataSource={detailData}
                        bordered
                        pagination={false}
                        scroll={{ x: detailTotalWidth, y: store.getState().tableHeight.y - 50 }}
                        className="inquiry-of-rejected-drugs"
                      // onRow={this.handleOnRow}
                      // rowClassName={this.handleRowClassName}
                      />
                      <CommonPagination size='small' current={detailPage} total={detailTotal} search='search'
                        onShowSizeChange={this.handleDetailCompilePage} complete={true} dataSource={detailData}
                        loading={loading} onChange={this.handleDetailCompilePage} />
                    </div>
                  </TabPane>
                </Tabs>
              </Card>
              <div style={{ width: '6px', background: 'rgba(240, 242, 245, 1)', position: 'absolute', top: 0, left: 0, height: '100%' }}></div>
            </div>
          </Col>
        </Row>
        <PublicModalTable onClickRowPublic={this.handleDrugRowClick} param={drugParam} onRef={this.onDrugRef} />
        <ColumnAuthoritysModel
          clientWidth='800px'
          compontName={this.state.parameterCode}
          configType="C"
          onRef={this.onColumnRef}
          reloadData={() => {
            if (this.state.parameterCode == 'drugInquiry') {
              this.getColumnsData();
            } else if (this.state.parameterCode == 'DrugDeliverySummaryInformation') {
              this.getSummaryColumns();
            } else if (this.state.parameterCode === "DrugDeliveryDetails") {
              this.getDetailColumns();
            }
          }
          }
        />
      </div>
    )
  }
}